<?php

include_once 'Expression.php';

/**
 * Represents a reference to an argument passes to a method
 * 
 * @package UC_PHPCodeModel
 * @author Uros Calakovic
 * @example ../Examples/ArgumentReferenceExpressionExample.php
 */

class ArgumentReferenceExpression extends Expression
{
    /**
     * ArgumentReferenceExpression constructor 
     * @param string $parameterName The name of the parameter
     */
    
    public function __construct($parameterName)
    {
        parent::__construct();
        $this->set_ParameterName($parameterName);
    }
    
    /**
     * The $Parameter getter method
     * @return string 
     */
    
    public function get_ParameterName()
    {
        return $this->ParameterName;
    }
    
    /**
     * The $ParameterName setter method
     * @param string $value The name of the parameter to be referenced
     * @throws InvalidArgumentException If the value is not a string
     * 
     * @assert (123) throws InvalidArgumentException
     * @assert (true) throws InvalidArgumentException
     * @assert (new stdClass()) throws InvalidArgumentException
     * @assert (array(1, 2, 3)) throws InvalidArgumentException
     */
    
    public function set_ParameterName($value)
    {
        if(is_string($value))
        {
            $this->ParameterName = $value;
        }
        else
        {
            throw new InvalidArgumentException(
                'The value must be a string.');
        }
    }

    /**
     * @var string The name of the parameter 
     */
    private $ParameterName;
}

?>
